#include "selectServer.hpp"
#include "err.hpp"

#include <memory>
using namespace std;
using namespace select_ns;

// ./SelectServer serverport

void Usage(std::string proc)
{
    std::cout << "\nUsage: \n\t" << proc << " serverport\n"
              << std::endl;
}

std::string transaction(const std::string &request)
{
    return request;
}

int main(int argc, char *argv[])
{
    if (argc != 2)
    {
        Usage(argv[0]);
        exit(USAGE_ERR);
    }

    uint16_t serverport = stoi(argv[1]);
    unique_ptr<SelectServer> svr(new SelectServer(transaction, serverport));

    svr->initServer();
    svr->start();

    return 0;
}